package com.example.e_booker;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
//import android.os.StrictMode;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;

import com.example.myfirstapp.R;

@SuppressLint("NewApi")
public class MainActivity extends Activity {
	public final static String EXTRA_MESSAGE = "com.example.e_booker.MESSAGE";

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
//		if (android.os.Build.VERSION.SDK_INT > 9) {
//		    StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
//		    StrictMode.setThreadPolicy(policy);
//		}

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}
	
	/** Called when the user clicks the Send button */
	public void sendMessage(View view) {
	    Intent intent = new Intent(this, DisplayMessageActivity.class);
	    EditText matriculaTextF = (EditText) findViewById(R.id.matricula_login);
	    EditText passwdTextF = (EditText) findViewById(R.id.passwd_login);
	    String matricula = matriculaTextF.getText().toString();
	    String passwd = passwdTextF.getText().toString();
	    String message = matricula+":"+passwd;
	    intent.putExtra(EXTRA_MESSAGE, message);
	    //intent.putExtra(EXTRA_MESSAGE, passwd);    

	    startActivity(intent);
	}

}
